<?php

class Form_Admin_Signup extends Form_Custom_General {

    public function init() {

        $name = $this->createElement('text', 'name')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Name should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array('class' => "span12", "placeholder" => "Name"));
        $this->addElement($name);

        $phone = $this->createElement('text', 'phone')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Phone should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array('class' => "span12", "placeholder" => "Phone"));
        $this->addElement($phone);

        $email = $this->createElement('text', 'email')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Email address should not be blank.')))
                ->addValidator(new Zend_Validate_EmailAddress())
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array('class' => "span12", "placeholder" => "E-mail address"));
        $email->getValidator('emailAddress')->setMessage("Email address is not valid.", Zend_Validate_EmailAddress::INVALID_FORMAT);
        $this->addElement($email);
        
        
        $minPwdValidator = new Zend_Validate_StringLength(array('min' => 6));
        $minPwdValidator->setMessage('Password should be minimum of 6 characters.');
        $password = $this->createElement('password', 'password')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Password should not be blank.')))
                ->addValidator($minPwdValidator, true)
                ->setAttribs(Array('class' => "span12", "placeholder" => "Password"));
        $this->addElement($password);

        $confirmpassword = $this->createElement('password', 'user_confirmpassword')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Confirm password should not be blank.')))
                ->setAttribs(Array('class' => "span12", "placeholder" => "Confirm password"));
        $this->addElement($confirmpassword);
    }

}